
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Docker常用安装 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="本地镜像发布到阿里云.html" />
    
    
    <link rel="prev" href="DockerFile解析.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" >
            
                <span>
            
                    
                    简介
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="Docker概念/docker基础概念.html">
            
                <a href="Docker概念/docker基础概念.html">
            
                    
                    Docker概念
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="Docker安装/docker安装流程Linux.html">
            
                <a href="Docker安装/docker安装流程Linux.html">
            
                    
                    Docker安装说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="Docker镜像加速/Docker阿里云镜像加速器配置.html">
            
                <a href="Docker镜像加速/Docker阿里云镜像加速器配置.html">
            
                    
                    Docker的镜像加速
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="Docker运行hello-world/Docker运行hello-world.html">
            
                <a href="Docker运行hello-world/Docker运行hello-world.html">
            
                    
                    Docker运行hello-world
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="Docker运行底层原理/Docker运行底层原理.html">
            
                <a href="Docker运行底层原理/Docker运行底层原理.html">
            
                    
                    Docker运行底层原理
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    命令
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="Docker常用命令.html">
            
                <a href="Docker常用命令.html">
            
                    
                    Docker常用命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="Docker镜像命令.html">
            
                <a href="Docker镜像命令.html">
            
                    
                    Docker镜像命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="Docker容器命令.html">
            
                <a href="Docker容器命令.html">
            
                    
                    Docker容器命令
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    原理
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="Docker镜像.html">
            
                <a href="Docker镜像.html">
            
                    
                    Docker镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="Docker容器数据卷.html">
            
                <a href="Docker容器数据卷.html">
            
                    
                    Docker容器数据卷
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="DockerFile解析.html">
            
                <a href="DockerFile解析.html">
            
                    
                    DockerFile解析
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.4.4" data-path="Docker常用安装.html">
            
                <a href="Docker常用安装.html">
            
                    
                    Docker常用安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="本地镜像发布到阿里云.html">
            
                <a href="本地镜像发布到阿里云.html">
            
                    
                    本地镜像发布到阿里云
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >Docker常用安装</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <!--
 * @Filename: 
 * @Description: 
 * @Author: liushuangdan
 * @Date: 2021-03-19 12:06:24
 * @LastEditTime: 2021-03-19 15:31:17
 * @FilePath: \DockerBook\Docker常用安装.md
-->
<h2 id="docker&#x5E38;&#x7528;&#x5B89;&#x88C5;">Docker&#x5E38;&#x7528;&#x5B89;&#x88C5;</h2>
<h3 id="&#x603B;&#x4F53;&#x6B65;&#x9AA4;">&#x603B;&#x4F53;&#x6B65;&#x9AA4;</h3>
<ol>
<li>&#x641C;&#x7D22;&#x955C;&#x50CF;</li>
<li>&#x62C9;&#x53D6;&#x955C;&#x50CF;</li>
<li>&#x67E5;&#x770B;&#x955C;&#x50CF;</li>
<li>&#x542F;&#x52A8;&#x955C;&#x50CF;</li>
<li>&#x505C;&#x6B62;&#x955C;&#x50CF;</li>
<li>&#x79FB;&#x9664;&#x955C;&#x50CF;</li>
</ol>
<h3 id="&#x5B89;&#x88C5;tomcat">&#x5B89;&#x88C5;tomcat</h3>
<ul>
<li>docker hub&#x4E0A;&#x9762;&#x67E5;&#x627E;tomcat&#x955C;&#x50CF;&#xFF0C; docker search tomcat </li>
<li>&#x4ECE;docker hub&#x4E0A;&#x62C9;&#x53D6;tomcat&#x955C;&#x50CF;&#x5230;&#x672C;&#x5730;&#xFF0C; docker pull tomcat<ul>
<li>&#x5B98;&#x7F51;&#x547D;&#x4EE4;
<img src="images/dockerFile/&#x62C9;&#x53D6;tomcat.png" alt="&#x62C9;&#x53D6;tomcat"></li>
<li>&#x62C9;&#x53D6;&#x5B8C;&#x6210;</li>
</ul>
</li>
<li>docker images &#x67E5;&#x770B;&#x662F;&#x5426;&#x62C9;&#x53D6;&#x5230;tomcat</li>
<li>&#x4F7F;&#x7528;tomcat&#x955C;&#x50CF;&#x521B;&#x5EFA;&#x5BB9;&#x5668;(&#x4E5F;&#x53EB;&#x8FD0;&#x884C;&#x955C;&#x50CF;) docker run -it -p 8080:8080 tomcat <ul>
<li>-p &#x4E3B;&#x673A;&#x7AEF;&#x53E3;&#xFF1A;docker&#x5BB9;&#x5668;&#x7AEF;&#x53E3;</li>
<li>-P &#x968F;&#x673A;&#x5206;&#x914D;&#x7AEF;&#x53E3; 
<img src="images/dockerFile/&#x968F;&#x673A;&#x5206;&#x914D;&#x7AEF;&#x53E3;.png" alt="&#x968F;&#x673A;&#x5206;&#x914D;&#x7AEF;&#x53E3;"></li>
<li>-i &#x4EA4;&#x4E92;</li>
<li>-t &#x7EC8;&#x7AEF; </li>
</ul>
</li>
</ul>
<h3 id="&#x5B89;&#x88C5;mysql">&#x5B89;&#x88C5;mysql</h3>
<ul>
<li>docker hub&#x4E0A;&#x9762;&#x67E5;&#x627E;mysql &#x955C;&#x50CF;</li>
<li>&#x4ECE;docker hub&#x4E0A; &#xFF08;&#x963F;&#x91CC;&#x4E91;&#x955C;&#x50CF;&#x52A0;&#x901F;&#x5668;&#xFF09;&#x62C9;&#x53D6;mysql&#x955C;&#x50CF;&#x5230;&#x672C;&#x5730;&#x6807;&#x7B7E;&#x4E3A;5.6</li>
<li><p>&#x4F7F;&#x7528;mysql5.6&#x955C;&#x50CF;&#x521B;&#x5EFA;&#x5BB9;&#x5668;(&#x4E5F;&#x53EB;&#x8FD0;&#x884C;&#x955C;&#x50CF;)</p>
<ul>
<li><p>&#x4F7F;&#x7528;mysql&#x955C;&#x50CF;</p>
<pre><code>    docker run -p 12345:3306 --name mysql -v /zzyyuse/mysql/conf:/etc/mysql/conf.d -v /zzyyuse/mysql/logs:/logs -v /zzyyuse/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.6

    &#x547D;&#x4EE4;&#x8BF4;&#x660E;&#xFF1A;
    -p 12345:3306&#xFF1A;&#x5C06;&#x4E3B;&#x673A;&#x7684;12345&#x7AEF;&#x53E3;&#x6620;&#x5C04;&#x5230;docker&#x5BB9;&#x5668;&#x7684;3306&#x7AEF;&#x53E3;&#x3002;
    --name mysql&#xFF1A;&#x8FD0;&#x884C;&#x670D;&#x52A1;&#x540D;&#x5B57;
    -v /zzyyuse/mysql/conf:/etc/mysql/conf.d &#xFF1A;&#x5C06;&#x4E3B;&#x673A;/zzyyuse/mysql&#x5F55;&#x4E0B;&#x7684;conf/my.cnf &#x6302;&#x8F7D;&#x5230;&#x5BB9;&#x5668;&#x7684; /etc/mysql/conf.d
    -v /zzyyuse/mysql/logs:/logs&#xFF1A;&#x5C06;&#x4E3B;&#x673A;/zzyyuse/mysql&#x76EE;&#x5F55;&#x4E0B;&#x7684; logs &#x76EE;&#x5F55;&#x6302;&#x8F7D;&#x5230;&#x5BB9;&#x5668;&#x7684; /logs&#x3002;
    -v /zzyyuse/mysql/data:/var/lib/mysql &#xFF1A;&#x5C06;&#x4E3B;&#x673A;/zzyyuse/mysql&#x76EE;&#x5F55;&#x4E0B;&#x7684;data&#x76EE;&#x5F55;&#x6302;&#x8F7D;&#x5230;&#x5BB9;&#x5668;&#x7684; /var/lib/mysql 
    -e MYSQL_ROOT_PASSWORD=123456&#xFF1A;&#x521D;&#x59CB;&#x5316; root &#x7528;&#x6237;&#x7684;&#x5BC6;&#x7801;&#x3002;
    -d mysql:5.6 : &#x540E;&#x53F0;&#x7A0B;&#x5E8F;&#x8FD0;&#x884C;mysql5.6
</code></pre><p><code>docker exec -it MySQL&#x8FD0;&#x884C;&#x6210;&#x529F;&#x540E;&#x7684;&#x5BB9;&#x5668;ID     /bin/bash</code>
<img src="images/dockerFile/mysql&#x542F;&#x52A8;.png" alt="mysql&#x542F;&#x52A8;"></p>
</li>
<li>&#x5916;&#x90E8;win10&#x4E5F;&#x6765;&#x94FE;&#x63A5;&#x8FD0;&#x884C;&#x5728;docker&#x4E0A;&#x7684;mysql&#x670D;&#x52A1;
<img src="images/dockerFile/&#x5916;&#x90E8;&#x94FE;&#x63A5;mysql.png" alt="&#x5916;&#x90E8;&#x94FE;&#x63A5;mysql"></li>
<li><p>&#x6570;&#x636E;&#x5907;&#x4EFD;&#x5C0F;&#x6D4B;&#x8BD5;</p>
<p><code>docker exec myql&#x670D;&#x52A1;&#x5BB9;&#x5668;ID sh -c &apos; exec mysqldump --all-databases -uroot -p&quot;123456&quot; &apos; &gt; /zzyyuse/all-databases.sql</code></p>
</li>
</ul>
</li>
</ul>
<h3 id="&#x5B89;&#x88C5;redis">&#x5B89;&#x88C5;redis</h3>
<ul>
<li>&#x4ECE;docker hub&#x4E0A; &#x963F;&#x91CC;&#x4E91;&#x52A0;&#x901F;&#x5668;&#x62C9;&#x53D6;redis&#x955C;&#x50CF;&#x5230;&#x672C;&#x5730;&#x6807;&#x7B7E;&#x4E3A;3.2</li>
<li>&#x4F7F;&#x7528;redis 3.2 &#x955C;&#x50CF;&#x521B;&#x5EFA;&#x5BB9;&#x5668; &#xFF08;&#x4E5F;&#x53EB;&#x8FD0;&#x884C;&#x955C;&#x50CF;&#xFF09;<ul>
<li>&#x4F7F;&#x7528;&#x955C;&#x50CF;<pre><code>    docker run -p 6379:6379 -v /zzyyuse/myredis/data:/data -v /zzyyuse/myredis/conf/redis.conf:/usr/local/etc/redis/redis.conf  -d redis:3.2 redis-server /usr/local/etc/redis/redis.conf --appendonly yes
</code></pre><img src="images/dockerFile/&#x4F7F;&#x7528;redis&#x955C;&#x50CF;.png" alt="&#x4F7F;&#x7528;redis&#x955C;&#x50CF;"></li>
<li>&#x5728;&#x4E3B;&#x673A;/zzyyuse/myredis/conf/redis.conf &#x76EE;&#x5F55;&#x4E0B;&#x65B0;&#x5EFA; redis.conf &#x6587;&#x4EF6; vim /zzyyuse/redis/conf/redis.conf/redis.conf
<a href="redis.txt">redis.conf</a></li>
</ul>
</li>
<li>&#x6D4B;&#x8BD5;redis-cli &#x94FE;&#x63A5;&#x4E0A;&#x6765;
  <code>docker exec -it &#x8FD0;&#x884C;&#x7740;Rediis&#x670D;&#x52A1;&#x7684;&#x5BB9;&#x5668;ID redis-cli</code>
  <img src="images/dockerFile/redis_cli&#x94FE;&#x63A5;.png" alt="redis_cli&#x94FE;&#x63A5;"></li>
<li>&#x6D4B;&#x8BD5;&#x6301;&#x4E45;&#x5316;&#x6587;&#x4EF6;&#x751F;&#x6210;
<img src="images/dockerFile/redis&#x6301;&#x4E45;&#x5316;.png" alt="redis&#x6301;&#x4E45;&#x5316;"></li>
</ul>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="DockerFile解析.html" class="navigation navigation-prev " aria-label="Previous page: DockerFile解析">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="本地镜像发布到阿里云.html" class="navigation navigation-next " aria-label="Next page: 本地镜像发布到阿里云">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Docker常用安装","level":"1.4.4","depth":2,"next":{"title":"本地镜像发布到阿里云","level":"1.4.5","depth":2,"path":"本地镜像发布到阿里云.md","ref":"本地镜像发布到阿里云.md","articles":[]},"previous":{"title":"DockerFile解析","level":"1.4.3","depth":2,"path":"DockerFile解析.md","ref":"DockerFile解析.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"Docker常用安装.md","mtime":"2021-03-19T07:31:18.357Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-03-19T07:46:19.806Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

